"""
日志记录：日志可能记录到本地硬盘、系统事件、远程服务器等，用户可以选择记录日志的位置。
"""
from abc import ABC, abstractmethod


class Logging(ABC):
    @abstractmethod
    def logging2save(self):
        pass


class LocalDiskLogging(Logging):
    def logging2save(self):
        print('日志记录到本地磁盘...')


class SystemEventLogging(Logging):
    def logging2save(self):
        print('日志记录到系统事件...')


class RemoteServerLogging(Logging):
    def logging2save(self):
        print('日志记录到远程服务器...')


class LoggingFactory:
    def create_logging(self, logging_type):
        if logging_type is None:
            return None

        if logging_type.upper() == 'LocalDisk'.upper():
            return LocalDiskLogging()
        elif logging_type.upper() == 'SystemEvent'.upper():
            return SystemEventLogging()
        elif logging_type.upper() == 'RemoteServer'.upper():
            return RemoteServerLogging()

        raise Exception('日志记录错误, 请核对记录位置...')


if __name__ == '__main__':
    logging_factory = LoggingFactory()
    remote_logging = logging_factory.create_logging('RemoteServer')
    remote_logging.logging2save()
